<?php
 
 
include_once('dbClass.php');
 
 
function checkLogin(){
	@session_start();
	if(empty($_SESSION['userid'])){
		alerts('',2,'../home/login.php');
	}
}
//***
//*过滤INPUT输入的数据
//***
function inputRep($val){
	$val = str_replace("'","",$val);
	$val = str_replace("<","&lt;",$val);
	$val = str_replace(">","&gt;",$val);
	$val = str_replace("%","%25",$val);
	$val = str_replace(";","",$val);
	return $val;
}
//***
//*过滤get输入的数据
//***
function getRep($val){
	$val = str_replace("'","",$val);
	$val = str_replace("<","&lt;",$val);
	$val = str_replace(">","&gt;",$val);
	$val = str_replace("%","%25",$val);
	$val = str_replace(";","",$val);
	return $val;
}
//***
//*过滤表单中text数据类型
//***
function postContent($val){
	$val = str_replace("<","&lt;",$val);
	$val = str_replace(">","&gt;",$val);
	return $val;
}
function alerts($val,$sortid,$gourl=""){
	if($sortid==1){
		echo("<script>alert('".$val."');history.back();</script>");
		exit();
	}else if($sortid==2){
		echo("<script>window.location='".$gourl."'</script>");
		exit();
	}else if($sortid==3){
		echo("<script>alert('".$val."');window.location='".$gourl."'</script>");
		exit();
	}
}


function page($page,$countSort,$pageSize,$countPageSize){
	echo '<div class="inline pull-right page">';
	echo '共有'.$countSort.'条记录，每页'.$pageSize.'条/共'.$countPageSize.'页 <a href="?page=1">首页</a>&nbsp;';
      
        if($page>1){

        echo '<a href="?page='.($page-1).'">上一页</a>';
       
        }else{
     
        echo '上一页';
       
        }
       
        for ($i=1; $i<=$countPageSize;$i++) { 
            echo '<a href="?page='.$i.'">'.$i.'</a>&nbsp;&nbsp;';
        }
        
        if($page<$countPageSize){
       
        echo '<a href="?page='.($page+1).'">下一页</a>';
       
        }else{
        
        echo '下一页';
       
        }
       
        echo '&nbsp;<a href="?page='.$countPageSize.'">尾页</a>&nbsp;&nbsp;';
}
 


?>